from django.conf import settings



if 'meercat.ui.django' in settings.INSTALLED_APPS:
    if not hasattr(settings, 'MEERCAT_SOLR_URL'):
        raise ValueError('Please add a MEERCAT_SOLR_URL to your settings.py file')
    
    if not hasattr(settings, 'MEERCAT_SOLR_DEFAULT_PARAMETERS'):
        settings.MEERCAT_SOLR_DEFAULT_PARAMETERS = {}
    
    if not isinstance(settings.MEERCAT_SOLR_DEFAULT_PARAMETERS, dict):
        raise ValueError('MEERCAT_SOLR_DEFAULT_PARAMETERS must be a dictionary')
    
    if not hasattr(settings, 'MEERCAT_SOLR_FORCED_PARAMETERS'):
        settings.MEERCAT_SOLR_FORCED_PARAMETERS = {}
    
    if not isinstance(settings.MEERCAT_SOLR_FORCED_PARAMETERS, dict):
        raise ValueError('MEERCAT_SOLR_FORCED_PARAMETERS must be a dictionary')
    
    if not hasattr(settings, 'MEERCAT_REST_URL'):
        raise ValueError('Please add a MEERCAT_REST_URL to your settings.py file')
    
    if not hasattr(settings, 'MEERCAT_DEFAULT_SEARCH_SLUG'):
        settings.MEERCAT_DEFAULT_SEARCH_SLUG = None